#pragma once

#include "teflon/application2d.h"

#include "teflon/graphics/renderer/sprite_renderer.h"
#include "teflon/graphics/renderer/bfont_renderer.h"
#include "teflon/graphics/renderer/mesh_renderer1.h"
#include "teflon/graphics/renderer/mesh_renderer.h"
#include "teflon/graphics/renderer/cubemap_renderer.h"
#include "teflon/graphics/renderable/animation2d.h"

#include "teflon/ui/uilayer.h"
#include "teflon/scene/environment.h"
#include "teflon/core/window.h"
#include "teflon/core/asset.h"
#include "teflon/core/rng.h"
#include "teflon/core/timer.h"


void create_sprites(std::vector<teflon::ColoredQuad>& sprites, uint32_t num_quads);


class Sample2d : public teflon::Application2d
{
private:
    std::shared_ptr<teflon::SpriteRenderer> renderer;
    std::shared_ptr<teflon::BFontRenderer> font_renderer;
    std::shared_ptr<teflon::UILayer> ui_renderer;

    teflon::Environment2D env2d;
    teflon::Timer timer;
    float frame_time = 0.0f;

    // sprites
    teflon::ColoredQuad sprite1;
    teflon::ColoredQuad sprite2;

    teflon::SpriteQuad sprite3;
    teflon::AnimatedSprite sprite4;
    // teflon::SpriteQuad sprite4;
    // std::vector<teflon::ColoredQuad> sprites;

    float camera2d_offset_x = 0.0f;
    float camera2d_offset_y = 0.0f;

public:
    Sample2d(const teflon::AppInfo2d& info);
    ~Sample2d() {}

    void Update();
    void RenderScene();
    void RenderUI();

    void Render()
    {
        RenderScene();
        RenderUI();
    }
};
